// 检查otplib的API
import { authenticator } from 'otplib';

const MY_SECRET = 'vuixppgt3kx3fbtjp2pzgfzzccxqkv7q';

console.log('=== 检查otplib API ===');

// 检查generate方法的参数
console.log('generate方法:', authenticator.generate);
console.log('generate方法长度:', authenticator.generate.length);

// 测试不同的调用方式
try {
  const code1 = authenticator.generate(MY_SECRET);
  console.log('generate(secret):', code1);
} catch (error) {
  console.log('generate(secret) 失败:', error.message);
}

try {
  const code2 = authenticator.generate(MY_SECRET, Date.now());
  console.log('generate(secret, timestamp):', code2);
} catch (error) {
  console.log('generate(secret, timestamp) 失败:', error.message);
}

try {
  const code3 = authenticator.generate({ secret: MY_SECRET });
  console.log('generate({secret}):', code3);
} catch (error) {
  console.log('generate({secret}) 失败:', error.message);
}

try {
  const code4 = authenticator.generate({ secret: MY_SECRET, time: Date.now() });
  console.log('generate({secret, time}):', code4);
} catch (error) {
  console.log('generate({secret, time}) 失败:', error.message);
}

// 检查其他方法
console.log('\n=== 其他方法 ===');
console.log('verify方法:', authenticator.verify);
console.log('timeRemaining方法:', authenticator.timeRemaining);
console.log('timeUsed方法:', authenticator.timeUsed);
